<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.qijia.travel.app.*"  %>
<%@ page import="com.qijia.travel.domain.*"  %>
<%@ page import="com.qijia.travel.helper.*"  %>
<%
FileUploadHelper helper = new FileUploadHelper();
		helper.setRequest(request);
		try {
			helper.work();
			List<String> fileNames = helper.getSavedFileName();

			Object bytes = helper.getParameterValue("touristGroupId");
			String groupId = new String((byte[])bytes,"UTF-8");
			GroupManager manager = new GroupManager();

			if (fileNames != null && fileNames.size() > 0) {
				String fileName = fileNames.get(0);
				TouristGroup touristGroup = new TouristGroup();
				touristGroup.setTouristFile(fileName);
				if (groupId instanceof String) {
					touristGroup.setTouristGroupId(Integer
							.parseInt(groupId));
					manager.updateTouristGroup(touristGroup);
				} 
			}
			out.println("<script>alert('上传文件成功!');window.close();window.parent.location.reload();</script>");
		} catch (Exception e) {
		    e.printStackTrace();
			out.println("<script>alert('上传文件处理失败!');window.close();window.parent.location.reload();</script>");
		}
%>
